package ch10oopexer1;

import java.util.InputMismatchException;
import java.util.Scanner;

/*2：计算平均课时:输入总课时和课程数,计算平均课时.
要求捕捉输入和除法错误;如果总课时少于100,抛出课时太少的错误*/
public class CourseTime {
    private int totalTime;
    private int totalCourse;
    private int average;

    Scanner scan = new Scanner(System.in);
    public CourseTime() {
    }

    public int getTotalTime() {
        return totalTime;
    }

    public void setTotalTime(int totalTime) {
        this.totalTime = totalTime;
    }

    public int getTotalCourse() {
        return totalCourse;
    }

    public void setTotalCourse(int totalCourse) {
        this.totalCourse = totalCourse;
    }
    public int chufa(int m, int n) {
            try {
                 average = m / n;
                return average;
            }catch (Exception e){
                System.err.println("除法错误");
                e.printStackTrace();
                return 0;
            }
    }
public int totalTimeMethod()throws Exception{
        try{
            if(getTotalTime()>100){

            }
            return getTotalTime();
        }catch (Exception e){
            throw new Exception("课程时长太少！");
        }
}

}
